import echarts from 'echarts';
/**
 * echart 初始化通用方法
 */
export default (config, chartID) => {
  // console.log("chartID",echarts.getInstanceByDom(document.getElementById(chartID)))
  let myChart = echarts.getInstanceByDom(document.getElementById(chartID));
  if( myChart === undefined){
      myChart = echarts.init(document.getElementById(chartID));
  }
  myChart.setOption(config);

  window.addEventListener('resize',()=>{
    myChart.resize();
  });
}